<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    128. Longest Consecutive Sequence
   </h1>
   <p>
    Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
   </p>
   <p>
    Your algorithm should run in O(
    <em>
     n
    </em>
    ) complexity.
   </p>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <pre>
<strong>Input:</strong>&nbsp;[100, 4, 200, 1, 3, 2]
<strong>Output:</strong> 4
<strong>Explanation:</strong> The longest consecutive elements sequence is <code>[1, 2, 3, 4]</code>. Therefore its length is 4.
</pre>
  </div>
  <div>
   <h1 class="question_title">
    128. 最长连续序列
   </h1>
   <p>
    给定一个未排序的整数数组，找出最长连续序列的长度。
   </p>
   <p>
    要求算法的时间复杂度为&nbsp;
    <em>
     O(n)
    </em>
    。
   </p>
   <p>
    <strong>
     示例:
    </strong>
   </p>
   <pre><strong>输入:</strong>&nbsp;[100, 4, 200, 1, 3, 2]
<strong>输出:</strong> 4
<strong>解释:</strong> 最长连续序列是 <code>[1, 2, 3, 4]。它的长度为 4。</code></pre>
  </div>
 </body>
</html>